package com.zqj.project.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @Description: PhoneDTO
 * @Author: 22001010704 Zhang Qijian
 * @CreateTime: 2024/12/8 18:32
 * @Version: 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
public class PhoneDTO implements Serializable {

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @NotBlank(message = "名称不能为空")
    @Size(min = 4, max = 24, message = "名称长度必须在4~24位之间")
    private String name;

    @NotBlank(message = "品牌不能为空")
    @Size(min = 2, max = 16, message = "品牌长度必须在2~16位之间")
    private String brand;

    @Size(max = 50, message = "处理器参数不能超过50个字")
    private String cpu;

    @Size(max = 50, message = "屏幕参数不能超过50个字")
    private String screen;

    @Size(max = 50, message = "电池参数不能超过50个字")
    private String battery;

    @Size(max = 50, message = "摄像头参数不能超过50个字")
    private String camera;

    @NotNull(message = "价格不能为空")
    @Min(value = 0, message = "价格不能小于0")
    @Max(value = 1000000, message = "价格不能超过1000000")
    private BigDecimal price;

    @Size(max = 255, message = "图片地址长度不能超过25")
    private String imageUrl;

    @Size(max = 200, message = "描述不能超过200个字")
    private String description;

    @NotNull(message = "库存不能为空")
    @Min(value = 0, message = "库存不能小于0")
    @Max(value = 10000000, message = "库存不能超过10000000")
    private Integer count;

    private BigDecimal lowerPrice;

    private BigDecimal upperPrice;

}